#include <iostream>
#include <string>
using namespace std;
struct Point
{
    char a, b, c;
} P[10000];

void Init()
{
    int ok = 1;
    for (int i = 1; i <= 64; i++)
    {
        if (ok)
            P[i].a = P[i].b = P[i].c = ':';
        else
            P[i].a = P[i].b = P[i].c = '.';
        if (i % 8)
            ok = !ok;
    }
}

int main()
{
    char x, y;
    int i, j;
    string White, Black;
    string tmp = "+---+---+---+---+---+---+---+---+";
    getline(cin, White);
    getline(cin, Black);
    Init();
    for (i = 7; i <= White.length() - 1; i++)
    {
        if (White[i] >= 'A' && White[i] <= 'Z')
        {
            x = White[i + 2], y = White[i + 1];
            P[(x - 48 - 1) * 8 + (y - 'a' + 1)].b = White[i];
        }
        else if (White[i - 1] == ',')
        {
            x = White[i + 1], y = White[i];
            P[(x - 48 - 1) * 8 + (y - 'a' + 1)].b = 'P';
        }
    }
    for (i = 7; i <= Black.length() - 1; i++)
    {
        if (Black[i] >= 'A' && Black[i] <= 'Z')
        {
            x = Black[i + 2], y = Black[i + 1];
            P[(x - 48 - 1) * 8 + (y - 'a' + 1)].b = Black[i] + 32;
        }
        else if (Black[i - 1] == ',')
        {
            x = Black[i + 1], y = Black[i];
            P[(x - 48 - 1) * 8 + (y - 'a' + 1)].b = 'p';
        }
    }
    cout << tmp << endl;
    for (i = 8; i >= 1; i--)
    {
        cout << '|';
        for (j = 1; j <= 8; j++)
            cout << P[(i - 1) * 8 + j].a << P[(i - 1) * 8 + j].b << P[(i - 1) * 8 + j].c << '|';
        cout << endl;
        cout << tmp << endl;
    }
    return 0;
}